package aspect

import (
	"github.com/astaxie/beego/logs"
	"github.com/gin-gonic/gin"
	"time"
)

func CommonrHandlerFunc() gin.HandlerFunc {
	return func(context *gin.Context) {
		logs.Info("CommonrHandlerFunc begin request={%v}, method={%v}", context.Request.RequestURI, context.Request.Method)
		begin := time.Now()
		context.Next()
		end := time.Now()
		res := end.Sub(begin)
		logs.Info("CommonrHandlerFunc end use time={%v}", res)
	}
}
